package com.smart.common.manager.factory;

import java.util.TimerTask;
import com.smart.util.IpAddressUtil;
import com.smart.entity.SysOperationLog;
import com.smart.common.component.SpringUtils;
import com.smart.service.SysOperationLogService;

public class AsyncFactory {
	
    /**
     * 操作日志记录
     * @param operLog 操作日志信息
     * @return 任务task
     **/
    public static TimerTask recordOper(final SysOperationLog operLog) {
        return new TimerTask(){
            @Override
            public void run() {
                String address=IpAddressUtil.getCityInfo(operLog.getOperIp());
                // 远程查询操作地点
                operLog.setOperLocation(address);
                SpringUtils.getBean(SysOperationLogService.class).save(operLog);
            }
        };
    }
}